In a virtual computing environment, devices may be removed from a host computer via a hot unplug, wherein the device is removed while a virtual machine is running. The device, however, typically has software (e.g., a device driver) executing within a guest running on the virtual machine that enables communication with the device. It is difficult to write or code the device software (e.g., the device driver) in a way that would enable the guest to handle the sudden disappearance of the device resulting from a hot unplug. As such, to remove a device, the device software on the guest operating system is first notified of the removal, explicitly acknowledges the hot unplug request, and enters a state in which it is safe to remove the device (e.g., including removing power from the device). However, this removal process may be time consuming, particularly if the guest is slow, the guest is not operating properly or if the guest lacks the hot unplug processing functionality.
In cases where a hot unplug of a device is initiated via a management interface of the hypervisor (e.g., by an administrator of the hypervisor), the hypervisor notifies the guest of the hot unplug request. In response, the guest notifies the device software of the request which in turn performs any necessary clean-up (e.g., removal of power from the device) to enable the safe removal of the device. In addition, the guest may perform operating system clean up to prepare for the safe removal of the device. Finally, the guest then notifies the hypervisor that it is safe to remove the device. However, there are instances when the guest is in a state in which it is unable to receive the hot unplug request (e.g., in a boot sequence or the guest is down), and the guest is unable to prepare the device software (e.g. the driver) for the removal of the device. In addition, the guest may receive the hot unplug notification, but the guest may be reset and lose the notification event and fail to take the necessary steps to prepare for the safe removal of the device.